//
// Created by cheng on 2021/02/09.
//

#include <iostream>

using namespace std;

int BinarySearch(int* A, int N, int key) {
    int sum = 0;
    auto pos = lower_bound(A, A+N, key);
    auto idx = distance(A, pos);
    cout << "a[" << idx << "] = " << *pos << endl;
    return 1;
}

int main() {
    int a[5] = {1, 3, 4, 6, 9};
    BinarySearch(a, 5, 4);
}